<?PHP
 session_start();
 include("admin/include/db.php");
 include("includes/session.php");
 
 $userId = $_SESSION['user_id'];


?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?=TITLE_WEBSITE?></title>
<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<center>
<div style="background:#179cc1; height:3px">&nbsp;</div>
<div style="width:990px;" align="center">
		<div id="header">
		<?php
    		include("includes/header.php");
   		?>
        </div>
    <div style="margin-top:20px;">
    	 <div style=" width:25%; float:left" >
        	 <?php include("includes/trainerLeftMenu.php");?>
        </div>
        <div style="width:75%;float:left">
        	<table width="600" style="border:1px solid #000" class="text" >
                        	<tr style=" background:#000;color:#FFF; font-weight:bold" height="30" >
                            	<td style="color:#FFF">&nbsp;Course Request Date</td>
                                <td style="color:#FFF">Course Name</td>
                                <td style="color:#FFF">Status</td>
                            </tr>
                            <?php
							$sqlCourses = mysql_query("SELECT * FROM software_user_courses WHERE user_id = '$userId'");
							while($resCourses = mysql_fetch_array($sqlCourses)){
								
								 $bgColor = 'bgcolor = "#F0F0F0"';
										
							?>
                            
                            <?php
								if($resCourses["assign_course"] == 'Y'){
									
									
									$stdCourse = mysql_query("SELECT SUCA.time_id,courses_id,course,number_classes,
																	start_date,end_date,first_name 
															   FROM software_users_courses_assign as SUCA 
																	INNER JOIN software_courses AS SC ON SUCA.courses_id = SC.name  
																	INNER JOIN software_user AS SU ON SU.id = SC.trainer_id       
															   WHERE user_id = '$userId' AND course = '".$resCourses["user_course"]."'");
														   
									$resStdCourse = mysql_fetch_array($stdCourse);
									
									if($resStdCourse["time_id"]!="")	
									{				   
							?>
                           <tr>
                             	<td colspan="3"  height="25" bgcolor="#4D4D4D" class="text-white"><strong>&nbsp;Course</strong></td>
                             </tr>
                            <tr <?=$bgColor?> height="25"  >
                            	<td ><?=date("Y-m-d H:i:s",$resCourses["course_date"])?></td>
                                <td ><?=$resCourses["user_course"]?></td>
                                <td><?=($resCourses["assign_course"] == 'Y' ? ' Active' : 'Non-Active')?></td>
                            </tr>
                            <tr>
                            	<td colspan="3" >
                                  <table width="100%"  class="text" style="border:1px solid #000; background:#F0F0F0" >	
                            	<tr  height="25"  >
                                    <td colspan="2" bgcolor="#000000" class="text-white" ><strong>Course Registeration Detail</strong></td>
                                    
                            	</tr>
                                <tr  height="25"  >
                                    <td width="30%" >Course Registeration Date</td>
                                    <td ><?= isset($resStdCourse["time_id"])? date("Y-m-d",$resStdCourse["time_id"]): '-'?></td>
                            	</tr>
                                <tr  height="25"  >
                                    <td width="30%" >Course</td>
                                    <td ><?=$resStdCourse["course"]?></td>
                            	</tr>
                                <tr  height="25"  >
                                    <td width="30%" >Course Code</td>
                                    <td ><?=$resStdCourse["courses_id"]?></td>
                            	</tr>
                              
                                <tr  height="25"  >
                                    <td width="30%" >Start Date</td>
                                    <td ><?=isset($resStdCourse["start_date"])? date("Y-m-d",strtotime($resStdCourse["start_date"])):'-'?></td>
                            	</tr>
                                <tr  height="25"  >
                                    <td width="30%" >End Date</td>
                                    <td ><?= isset($resStdCourse["end_date"])?date("Y-m-d",strtotime($resStdCourse["end_date"])):'-'?></td>
                            	</tr>
                                <tr  height="25"  >
                                    <td width="30%" >Trainer Name</td>
                                    <td ><?=$resStdCourse["first_name"]?></td>
                            	</tr>
                                <tr  height="25"  >
                                    <td width="30%" >Classes</td>
                                    <td ><?=$resStdCourse["number_classes"]?></td>
                            	</tr>
                                </table>
                               </td>
                              </tr>  
                                <tr>
                             	<td colspan="3" height="30">&nbsp;</td>
                             </tr> 	
							<?php
								
									}
                                 }
								 else
								 {
							?>
							 <tr>
                             	<td colspan="3" class="clsError" height="30">No,Course Assign</td>
                             </tr>
                             <tr>
                             	<td colspan="3" height="30">&nbsp;</td>
                             </tr>
							<?php
									 
								 }
							 }
							?>
							
						</table>
        	
        </div>
        <div style="clear:both"></div>
    </div>
    
    <div style="margin-top:23px; margin-bottom:21px" align="center" >
    	<?php
									$sqlAdvertise = mysql_query("SELECT * FROM software_advertise 
																	WHERE 
																		banner_status = 'Y' AND banner = 2
																		ORDER BY RAND()
																		");
									$resAdvertise = mysql_fetch_array($sqlAdvertise);
							
									$imgPath  = 'admin/upload_images/'.$resAdvertise["banner_image"];
									
								?>
								
    </div>
   </div>
   <div id="footer">
  		<?php include("includes/footer.php")?>
   </div>
</div>
	</div>
</center>
</body>
</html>
